{% extends "base.html" %}
{% block title %}任务明细{% endblock %}
{% block user %}任务明细{% endblock %}

{% block scripts %}{{ super() }}
<script>
    $(function () {
        var graphs = {{ category_data | safe
    }};
    Plotly.plot('categoryData', [graphs], {});
        });

    $(function () {
        var graphs = {{ user_data | safe
    }};
    Plotly.plot('userData', [graphs], {});
        });



    $(document).ready(function () {
        $('#dt').DataTable(
            {

                "autoWidth": false,
                "search": {
                    "regex": true
                },

                "pageLength": 25,
                "order": [[5, "desc"]],

                dom: '<"top"flipB<"clear">>rt<"bottom"ipB<"clear">>',
                buttons: [
                    'copy', 'csv', 'excel'
                ]
            });
    });
</script>
{% endblock %}
{% block content %}
<div class="container">
    <div class="row">
        <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
            {% include 'flash_message.html' %}
        </div>
        <h3 class="page-header" style="text-align:center">
            {{ project_name[0][0] }}
            {{ project_name[0][1] }}
        </h3>
        <div class="col-xs-6 col-sm-6 col-md-6 col-lg-6">
            <div class="chart" id="categoryData">
            </div>
        </div>
        <div class="col-xs-6 col-sm-6 col-md-6 col-lg-6">
            <div class="chart" id="userData">
            </div>
        </div>


        <h3 class="row page-header" style="text-align:center">
            <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">

                填报明细
            </div>
            </h4>

            <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
                <table id="dt" class="row-border hover compact" style="width:100%">
                    <thead>
                        <tr>
                            <th>工号</th>
                            <th>姓名</th>
                            <th>大类</th>
                            <th>分类</th>
                            <th>工时</th>
                            <th>日期</th>
                            <th>创建时间</th>

                            <th>描述</th>
                            <th>备注</th>

                        </tr>
                    </thead>
                    <tbody>
                        {% for task in tasks %}
                        <tr>
                            <td>{{ task[3] }}</td>
                            <td>{{ task[4] }}</td>
                            <td>{{ task[5] }}</td>
                            <td>{{ task[6] }}</td>
                            <td>{{ task[7] }}</td>
                            <td>{{ task[8].strftime('%Y-%m-%d') }}</td>
                            <td>{{ task[9] }}</td>
                            <td>{{ task[1] }}</td>
                            <td>{{ task[2] }}</td>
                        </tr>
                        {% endfor %}
                    </tbody>
                </table>
            </div>
    </div>
</div>
{% endblock %}